# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-uvloop
pkgver=0.16.0
pkgrel=0
pkgdesc="Ultra fast asyncio event loop"
url="https://github.com/MagicStack/uvloop"
license="MIT OR Apache-2.0"
arch="all !armhf !ppc64le" # tests fail
depends="python3"
makedepends="py3-setuptools python3-dev cython libuv-dev"
checkdepends="py3-pytest py3-aiohttp py3-openssl py3-psutil"
source="https://github.com/MagicStack/uvloop/archive/v$pkgver/py3-uvloop-$pkgver.tar.gz
	dns-tests.patch
	tcp-tests.patch
	"
builddir="$srcdir/uvloop-$pkgver"

build() {
	python3 setup.py build build_ext --inplace --cython-always --use-system-libuv
}

check() {
	PYTHONASYNCIODEBUG=1 PYTHONPATH="$(echo "$builddir"/build/lib.linux-*)" pytest -v \
		-k 'not test_remote_shutdown_receives_trailing_data'
}

package() {
	python3 setup.py install --root="$pkgdir" --skip-build
}

sha512sums="
1896d9a60a9c4e4b8d146ad858e664f3e43969ad0c14026fe79c69f546e40bf1dc6a4cce2d388a7a6e0f5b8306b1eb4da3f713cce44c58ba6628b82ac6eaf271  py3-uvloop-0.16.0.tar.gz
072c955662a9922de1f08713a73f0f9a08bd76b82cabd04e15cbb8b8299d81615516d03bdff207d2f0125afe055e9573604ebc331ad85f5d69ec6bf69668e620  dns-tests.patch
809af42dc056b718652ff1e2f99cc493b230a9566367bccf349afc705653ffb830288b7de80bc6016071980af5d5e0e635e72d53f7774ace193ce4fb2b1a62cc  tcp-tests.patch
"
